#ifndef __SVMCLASSIFY_H__
#define __SVMCLASSIFY_H__

#include "svmClassifyConfig.h"
#include "svmClassifyData.h"

class svmClassify {
public:
	svmClassify(svmClassifyConfig * _config, svmClassifyData * _data):config(_config),testData(_data) {}
	void classify();
	void printClassification();
	void cleanResult();
	float* result;
private:
	inline void allocate();
	inline void release();
	inline void resetDevData(unsigned int);
	inline void mapReduce();
	inline void findClass(int);
	inline unsigned int nextPow2(unsigned int);

	svmClassifyConfig * config;
	svmClassifyData * testData;

	int nPointsInSlice;

	float* devSV;
	float* devAlpha;
	float* devSVDots;
	float* devRho;
	float* devData;
	float* devDataDots;
	float* devResult;
	float* devDots;

	size_t devSVPitch;
	int devSVPitchInFloats;
	size_t devAlphaPitch;
	int devAlphaPitchInFloats;
	size_t devDataPitch;
	int devDataPitchInFloats;
	size_t devResultPitch;
	int devResultPitchInFloats;
	size_t devDotsPitch;
	int devDotsPitchInFloats;

	size_t maxPitch;

	float sgemmAlpha;
	float sgemmBeta;

	//cudaStream_t stream[16];
};

#endif